﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;

namespace ZoneLineNew.Converts {

    public class WorkActionConvert : IValueConverter {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
            if (value is int act) {
                switch (act) {
                    case 0: return "等待中";
                    case 1: return "允许工作";
                    case 2: return "该工件已在本工位加工完成";
                    case 3: return "该工件未在上工位加工";
                    case 4: return "该工件在上工位加工不合格";
                    case 5: return "该工件未启用";
                }
            }
            return "未知信号值" + value?.ToString();
        }


        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
            throw new NotImplementedException();
        }
    }

    public class WorkActionColorConvert : IValueConverter {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
            if (value is int act) {
                switch (act) {
                    case 0: return "#FFe9af20";//return new SolidColorBrush(Colors.Yellow); // return "等待中";
                    case 1: return "#FF2DB84D";//return new SolidColorBrush(Colors.Green); //return "允许工作";
                    case 2: return "#FFDB3340";//return "该工件已在本工位加工完成";
                    case 3: return "#FFDB3340";//return new SolidColorBrush(Colors.Red);// return "该工件未在上工位加工";
                    case 4: return "#FFDB3340";//return new SolidColorBrush(Colors.Red);// return "该工件在上工位加工不合格";
                    case 5: return "#FFDB3340";//return new SolidColorBrush(Colors.Red);// return "该工件未启用";
                }
            }
            return new SolidColorBrush(Colors.Yellow);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
            throw new NotImplementedException();
        }
    }
}
